
#ifndef BSP_SPI_PRE 
#define BSP_SPI_PRE 


#ifdef  BSP_SPI_MOD
#define BSP_SPI_EXT
#else
#define BSP_SPI_EXT extern
#endif

#include "FreeRTOS.h"
#include "semphr.h"
#include "stm32f0xx_hal_spi.h"



#define BSP_SPI1_NSS_Pin GPIO_PIN_3
#define BSP_SPI1_NSS_GPIO_Port GPIOB

#if 0
#define BSP_SPI1_NSS_CS  HAL_GPIO_WritePin(BSP_SPI1_NSS_GPIO_Port, BSP_SPI1_NSS_Pin, 0);
#define BSP_SPI1_NSS_NCS HAL_GPIO_WritePin(BSP_SPI1_NSS_GPIO_Port, BSP_SPI1_NSS_Pin, 1);
#endif

typedef struct
{
  SPI_HandleTypeDef hspi1;
	SemaphoreHandle_t lock;
}tSPI;







BSP_SPI_EXT tSPI bsp_spi;


BSP_SPI_EXT BaseType_t bsp_spi_lock(void);
BSP_SPI_EXT void bsp_spi_unlock(void);
BSP_SPI_EXT HAL_StatusTypeDef bsp_spi_init(tSPI *spi);















#endif
